package com.aloha.auth.utils;

import com.aloha.auth.domain.User;

/**
 * @author zhdai
 * @date 2023/11/9 22:01
 */
public class UserHolder {
    private static final ThreadLocal<User> USER_THREAD_LOCAL = new ThreadLocal<>();

    public static void setUser(User user) {
        USER_THREAD_LOCAL.set(user);
    }

    public static User getUser() {
        return USER_THREAD_LOCAL.get();
    }

    public static void removeUser() {
        USER_THREAD_LOCAL.remove();
    }
}
